###########################################################################
# $Id: conceptObjectTextItem.p 45 2009-07-14 09:07:27Z donbeave $
###########################################################################

@CLASS
conceptObjectTextItem

@USE
concept/models/conceptBaseItem.p

@BASE
conceptBaseItem

@OPTIONS
locals

#----- Constructor -----

@create[hshData;hshOptions]
  ^cleanMethodArgument[hshOptions]

  ^if(!def $hshOptions.classify){
    $hshOptions.classify[ObjectsTexts]
  }

  ^BASE:create[$hshData;$hshOptions]

#----- Public -----

@factory[hshData;hshOptions]
  $result[^conceptObjectTextItem::create[$hshData;$hshOptions]]

@publish[blnPublish]
  $self._IsPublished(^blnPublish.bool(true))
  $result[]

@save[]
  ^if(^isExist[]){
    $result(^DATA_MANAGER.editObjectText[$self])
  }{
     $result(^DATA_MANAGER.addObjectText[$self])
   }

@remove[]
  $result(^DATA_MANAGER.removeObjectText[$self])

#----- Properties -----

@GET_object[]
  ^if(^ObjectID.int(0)){
    $result[^STORAGE.getObjectByID(^ObjectID.int(0))]
  }{
     $result[^STORAGE.getTemporaryObject[$self._ObjectUID]]
   }

@GET_locale[]
  $result[^STORAGE.getLocaleByID(^LocaleID.int(0))]

 #----- Private -----

@_toHash[]
  $result[^BASE:_toHash[]]

  ^if(!^isExist[]){
    $result.ObjectUID[$object.UID]
  }